package xml.tests;

import java.io.File;
import java.io.IOException;

import javax.xml.XMLConstants;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;

import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.SAXException;

import junit.framework.Assert;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import xml.ConverterToUidXml;

public class TestConverterOutro extends TestCase {
	
	ConverterToUidXml converter = new ConverterToUidXml();
	
	public void testCD1(){
		
		converter.convert("src/testFiles/UC1-CD.xuid", "src/testFiles/UC1-CD.xml");
//		assertEquals(artigosSemRevisao.get(0).getNome(), "Artigo1");
	}
	
	private static void validateXmlModel(String xmlFile) throws IOException {
		try {
			SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.XML_DTD_NS_URI);
			Schema schema = schemaFactory.newSchema(new File("src/testFiles/uid-2-0.dtd"));
			Validator validator = schema.newValidator();
			validator.validate(new StreamSource(xmlFile));
		} catch (SAXException e) {
			Assert.fail(xmlFile + " is NOT valid" + " - reason: " + e.getLocalizedMessage());
		}
	}
	
	@Test
	@Ignore
	public void tttt() {

	}


	public static void main (String[] args){
		TestSuite suite = new TestSuite(TestConverterOutro.class);
		junit.textui.TestRunner.run(suite);
	}


}
